#pragma once

#include "njm_window.hpp"
#include "njm_device.hpp"
#include "njm_renderer.hpp"
#include "njm_game_obj.hpp"
#include "njm_descriptor.hpp"
#include "njm_img.hpp"
#include "njm_texture.hpp"


#include <memory>
#include <vector>

namespace njm {

    class FirstApp
    {
    private:
        NjmWindow njmWindow{WIDTH, HEIGHT, "FIRST APP"};
        NjmDevice njmDevice{njmWindow};
        NjmRenderer njmRenderer{njmWindow, njmDevice};

        std::vector<NjmImg::id_t> imgIds;
        std::vector<NjmTexture::id_t> texIds;
        // std::vector<NjmGameObj::id_t> objIds;
        // std::vector<NjmModel::id_t> modelIds;

        std::unique_ptr<NjmDescriptorPool> globalPool{};
        NjmGameObj::Map gameObjs;
        NjmImg::Map njmImgs;
        
        void loadGameObjs();
        void loadImgs();
        void printAssetsInfo();
        
    public:
        static constexpr int WIDTH = 800;
        static constexpr int HEIGHT = 800;
        static constexpr float MAX_FRAME_TIME = 0.05f; // 50ms
        void run();

        FirstApp();
        ~FirstApp();
        FirstApp(const FirstApp&) = delete;
        FirstApp &operator=(const FirstApp&) = delete;
    };
}